﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="EnetaMvc.Core.Domain.SLA.SlaMonitoringLog, EnetaMvc.Core" table="sla_log_entries" abstract="true">

    <id name="Id" column="sla_log_entry_id" type="long">
      <generator class="identity"/>
    </id>
    <discriminator column="discriminator" not-null="true" type="String"/>
    
    <property name="PreviousStateDate" column="previous_state_date" type="DateTime" />
    <property name="NewStateDate" column="new_state_date" type="DateTime" />
    <many-to-one name="PreviousPublishState" column="previous_state_id" class="EnetaMvc.Core.Domain.Content.PublishState, EnetaMvc.Core" />
    <many-to-one name="PreviousPublishStateUser" column="prvious_state_user_id" class="EnetaMvc.Core.Domain.Common.User, EnetaMvc.Core" />
    <many-to-one name="User" column="user_id" class="EnetaMvc.Core.Domain.Common.User, EnetaMvc.Core" />
    <many-to-one name="NewPublishState" column="new_state_id" class="EnetaMvc.Core.Domain.Content.PublishState, EnetaMvc.Core" />
    
    <subclass name="EnetaMvc.Core.Domain.SLA.ContentItemSlaLog, EnetaMvc.Core" discriminator-value="contentitem">
      <many-to-one name="ContentItem" column="content_item_id" class="EnetaMvc.Core.Domain.Content.ContentItem, EnetaMvc.Core" not-null="false" />  
    </subclass>
    <subclass name="EnetaMvc.Core.Domain.SLA.BlogSlaLog, EnetaMvc.Core" discriminator-value="blog">
      <many-to-one name="Blog" column="blog_id" class="EnetaMvc.Core.Domain.News.Blog, EnetaMvc.Core" not-null="false" />
    </subclass>
  </class>
</hibernate-mapping>